ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1D
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA # could not find variable listed in spreadsheet, F5A/B
# subset
survey_2624SLvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
## second data set
survey <- read.dta13("harris_s2624_nonvoter_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- NA
# inequality variable (inequality.variable)
survey$inequality.variable <- NA
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1B
# gender
survey$gender <- survey$F8
# religion
survey$religion <- survey$F5A
# subset
survey_2624SLnonvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
survey_2624 <- rbind(survey_2624SLnonvoters, survey_2624SLvoters)
summary(survey_2624)
table(survey_2624$inequality)
survey_2624$inequality <- factor(survey_2624$inequality)
table(survey_2624$inequality)
summary(survey_2624$inequality)
survey_2624$inequality <- recode(survey_2624$inequality,
`Don t feel` = "Don't Feel",
`Not sure` = "Not Sure")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 ABC Presidential Election Survey, study no. 2624S-L")
library(dplyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2624_voters_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13,
"'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
class(survey$urban)
summary(survey$urban)
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q6_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
class(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1D
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA # could not find variable listed in spreadsheet, F5A/B
# subset
survey_2624SLvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
## second data set
survey <- read.dta13("harris_s2624_nonvoter_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- NA
# inequality variable (inequality.variable)
survey$inequality.variable <- NA
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1B
# gender
survey$gender <- survey$F8
# religion
survey$religion <- survey$F5A
# subset
survey_2624SLnonvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
survey_2624SL <- rbind(survey_2624SLnonvoters, survey_2624SLvoters)
summary(survey_2624SL)
survey_2624SL$inequality <- factor(survey_2624SL$inequality)
summary(survey_2624SL$inequality)
survey_2624SL$inequality <- dplyr::recode(survey_2624SL$inequality,
`Don t feel` = "Don't Feel",
`Not sure` = "Not Sure")
summary(survey_2624SL$inequality)
survey_2624SL$pid <- c(1:nrow(survey_2624SL))
summary(survey_2624SL)
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 ABC Presidential Election Survey, study no. 2624S-L")
library(dplyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2624_voters_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13,
"'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
class(survey$urban)
summary(survey$urban)
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q6_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
class(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1D
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA # could not find variable listed in spreadsheet, F5A/B
# subset
survey_2624SLvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
saveRDS(survey_2624SLvoters, file = "survey_2624SLvoters.rds")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 ABC Presidential Election Survey, study no. 2624S-L")
library(dplyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2624_voters_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13,
"'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
class(survey$urban)
summary(survey$urban)
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q6_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
class(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.character(survey$F3_1)
survey$union.self[survey$F3_4 == "Yes"] <- "Not Sure"
survey$union.self <- factor(survey$union.self)
survey$union.other <- as.character(survey$F3_2)
survey$union.other[survey$F3_4 == "Yes"] <- "Not Sure"
survey$union.other <- factor(survey$union.other)
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1D
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA # could not find variable listed in spreadsheet, F5A/B
# subset
survey_2624SLvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_2624SLvoters)
saveRDS(survey_2624SLvoters, file = "survey_2624SLvoters.rds")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 Blacks in America Survey, study no. 7683")
library(dplyr)
library(tidyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s7683_blacks_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 7683
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- car::recode(survey$F1, "c('Male head', 'Female head (no male head)') = 'Yes';
c('Wife', 'Son', 'Daughter', 'Other (specify)') = 'No'; else = NA")
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q7_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.character(survey$F6_1)
survey$union.self[survey$F6_4 == "Yes"] <- "Not Sure"
survey$union.self <- factor(survey$union.self)
survey$union.other <- as.character(survey$F6_2)
survey$union.other[survey$F6_4 == "Yes"] <- "Not Sure"
survey$union.other <- factor(survey$union.other)
# employment (employed)
survey$employed <- survey$F2A
# occupation
survey$occupation <- survey$F2B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- as.numeric(survey$F5)
survey$educ <- car::recode(survey$educ, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F7
# age
survey$age <- survey$F4
# race
survey$race <- survey$F10 # all are black
# politics (party)
survey$party <- survey$P3D
# politics (ideology)
survey$ideology <- survey$P3A
# gender
survey$gender <- survey$F11
# religion
survey$religion <- survey$F8
# subset
survey_7683 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_7683)
saveRDS(survey_7683, file = "survey_7683-blacks.rds")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 Blacks in America Survey, study no. 7683")
library(dplyr)
library(tidyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s7683_whites_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 7683
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- car::recode(survey$F1, "c('Male head', 'Female head (no male head)') = 'Yes';
c('Wife', 'Son', 'Daughter', 'Other (specify)') = 'No'; else = NA")
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q7_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.character(survey$F6_1)
survey$union.self[survey$F6_4 == "Yes"] <- "Not Sure"
survey$union.self <- factor(survey$union.self)
survey$union.other <- as.character(survey$F6_2)
survey$union.other[survey$F6_4 == "Yes"] <- "Not Sure"
survey$union.other <- factor(survey$union.other)
# employment (employed)
survey$employed <- survey$F2A
# occupation
survey$occupation <- survey$F2B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- as.numeric(survey$F5)
survey$educ <- car::recode(survey$educ, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F7
# age
survey$age <- survey$F4
# race
survey$race <- survey$F10
# politics (party)
survey$party <- survey$P3D
# politics (ideology)
survey$ideology <- survey$P3A
# gender
survey$gender <- survey$F11
# religion
survey$religion <- survey$F8
# subset
survey_7683 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_7683)
saveRDS(survey_7683, file = "survey_7683-whites.rds")
